package hdfs;

import java.io.IOException;
import java.io.InputStream;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;

public class FileSystemTest {

	public static void main(String[] args) throws IOException {
		
		Configuration conf = new Configuration();
		conf.set("mapred.job.tracker", "master:9001");
		conf.set("fs.default.name", "hdfs://master:9000");
		FileSystem fs = FileSystem.get(conf);
		InputStream in = fs.open(new Path("/user/hadoop/in/file1"));
		IOUtils.copyBytes(in, System.err, 1024);
		IOUtils.closeStream(in);
	}
}
